package client.model;

/**
 * 
 * @author Niclas
 */
public class ShipCounter {
	
	private static ShipCounter instance = null;

	public static ShipCounter getInstance() {
		if (instance == null) {
			instance = new ShipCounter();
		}
		return instance;
	}
	
	
	
	public static int DAFAULT_SCHLACHTSCHIFF_LENGHT = 5;
	public static int DAFAULT_KREUZER_LENGHT = 4;
	public static int DAFAULT_ZERSTOERER_LENGHT = 3;
	public static int DAFAULT_UBOOT_LENGHT = 2;
	
	private int schlachtschiffCount = 1;
	private int kreuzerCount = 2;
	private int zerstoererCount = 3;
	private int ubootCount = 4;
	
	public boolean subtractSchlachtschiff(){
		if (schlachtschiffCount > 0){
			schlachtschiffCount--;
			return true;
		}
		else {
			return false;
		}	
	}
	
	public boolean isSchlachtschiffAvailable(){
		return schlachtschiffCount > 0;
	}
	
	public boolean subtractKreuzer(){
		if (kreuzerCount > 0){
			kreuzerCount--;
			return true;
		}
		else {
			return false;
		}	
	}
	
	public boolean isKreuzerAvailable(){
		return kreuzerCount > 0;
	}
	
	public boolean subtractZerstoerer(){
		if (zerstoererCount > 0){
			zerstoererCount--;
			return true;
		}
		else {
			return false;
		}	
	}
	
	public boolean isZerstoererAvailable(){
		return zerstoererCount > 0;
	}
	
	
	public boolean subtractUboot(){
		if (ubootCount > 0){
			ubootCount--;
			return true;
		}
		else {
			return false;
		}	
	}
	
	public boolean isUbootAvailable(){
		return ubootCount > 0;
	}

	public int getSchlachtschiff() {
		return schlachtschiffCount;
	}

	public int getKreuzer() {
		return kreuzerCount;
	}

	public int getZerstoerer() {
		return zerstoererCount;
	}

	public int getUboot() {
		return ubootCount;
	}
	
	
	
	
}
